test(pyamber): add unit tests for attribute_type_utils - #6833
test(pyamber): add unit tests for attribute_type_utils#6833Amer-Mukhtar wants to merge 4 commits into
Conversation
Automated Reviewer SuggestionsBased on the
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 379 | 0.231 | 25,487/36,972/36,972 us | 🔴 +8.0% / 🔴 +122.8% |
| ⚪ | bs=100 sw=10 sl=64 | 803 | 0.49 | 122,477/144,274/144,274 us | ⚪ within ±5% / 🔴 +32.2% |
| ⚪ | bs=1000 sw=10 sl=64 | 901 | 0.55 | 1,109,136/1,147,208/1,147,208 us | ⚪ within ±5% / 🔴 +10.7% |
Baseline details
Latest main 57d4dba from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 379 tuples/sec | 399 tuples/sec | 754.55 tuples/sec | -5.0% | -49.8% |
| bs=10 sw=10 sl=64 | MB/s | 0.231 MB/s | 0.243 MB/s | 0.461 MB/s | -4.9% | -49.8% |
| bs=10 sw=10 sl=64 | p50 | 25,487 us | 24,980 us | 12,816 us | +2.0% | +98.9% |
| bs=10 sw=10 sl=64 | p95 | 36,972 us | 34,240 us | 16,594 us | +8.0% | +122.8% |
| bs=10 sw=10 sl=64 | p99 | 36,972 us | 34,240 us | 19,806 us | +8.0% | +86.7% |
| bs=100 sw=10 sl=64 | throughput | 803 tuples/sec | 808 tuples/sec | 969.38 tuples/sec | -0.6% | -17.2% |
| bs=100 sw=10 sl=64 | MB/s | 0.49 MB/s | 0.493 MB/s | 0.592 MB/s | -0.6% | -17.2% |
| bs=100 sw=10 sl=64 | p50 | 122,477 us | 121,264 us | 103,584 us | +1.0% | +18.2% |
| bs=100 sw=10 sl=64 | p95 | 144,274 us | 139,983 us | 109,097 us | +3.1% | +32.2% |
| bs=100 sw=10 sl=64 | p99 | 144,274 us | 139,983 us | 117,304 us | +3.1% | +23.0% |
| bs=1000 sw=10 sl=64 | throughput | 901 tuples/sec | 900 tuples/sec | 1,004 tuples/sec | +0.1% | -10.2% |
| bs=1000 sw=10 sl=64 | MB/s | 0.55 MB/s | 0.549 MB/s | 0.613 MB/s | +0.2% | -10.2% |
| bs=1000 sw=10 sl=64 | p50 | 1,109,136 us | 1,114,641 us | 1,002,357 us | -0.5% | +10.7% |
| bs=1000 sw=10 sl=64 | p95 | 1,147,208 us | 1,172,225 us | 1,046,463 us | -2.1% | +9.6% |
| bs=1000 sw=10 sl=64 | p99 | 1,147,208 us | 1,172,225 us | 1,073,661 us | -2.1% | +6.9% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,527.89,200,128000,379,0.231,25487.09,36972.41,36972.41
1,100,10,64,20,2491.91,2000,1280000,803,0.490,122476.70,144274.12,144274.12
2,1000,10,64,20,22188.40,20000,12800000,901,0.550,1109135.77,1147207.89,1147207.89
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Pull request overview
Adds missing unit-test coverage for the Python worker’s core.models.schema.attribute_type_utils conversion helpers, ensuring Arrow ↔ AttributeType mapping (including LARGE_BINARY’s metadata-based encoding) is validated and protected against regressions.
Changes:
- Introduces a new pytest module covering
detect_attribute_type_from_arrow_fieldacross supported Arrow types, timestamp units, metadata precedence, and error behavior for unsupported types. - Adds coverage for
create_arrow_field_with_metadata, includingLARGE_BINARYmarker metadata behavior and round-trip preservation through Arrow schemas.
Comments suppressed due to low confidence (1)
amber/src/test/python/core/models/schema/test_attribute_type_utils.py:179
- Similar to the earlier metadata check: comparing
field.metadatato a plain dict can be fragile. Prefer asserting the presence/value of thetexera_typemarker to avoid version-specific equality behavior.
def test_unicode_name_survives_on_a_large_binary_field(self):
field = create_arrow_field_with_metadata("列名", AttributeType.LARGE_BINARY)
assert field.name == "列名"
assert field.metadata == LARGE_BINARY_METADATA
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Amer Mukhtar <136252708+Amer-Mukhtar@users.noreply.github.com>
Description
What changes were proposed in this PR?
amber/src/test/python/core/models/schema/test_attribute_type_utils.py, a new pytest spec for the Python worker'sattribute_type_utils, which previously had no dedicated unit tests.detect_attribute_type_from_arrow_field: every supported Arrow type, timestamps across all four units, thetexera_type: LARGE_BINARYmetadata marker taking precedence over the Arrow type, metadata that doesn't mark large binary falling back to the type mapping, and unmapped Arrow types raisingKeyError.create_arrow_field_with_metadata: everyAttributeType, metadata attached only forLARGE_BINARY, attribute names preserved verbatim (empty, unicode, emoji, long), and non-AttributeTypeinput raisingKeyError.LARGE_BINARYfield degrades it toSTRING.Any related issues, documentation, discussions?
Closes: #6635
How was this PR tested?
cd amber && pytest src/test/python/core/models/schema/test_attribute_type_utils.py -v, expect all 67 tests passing.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude